package cn.webestar.scms.user.mapper;

import cn.webestar.scms.mybatisplus.cache.CacheHelper;
import cn.webestar.scms.user.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 角色
 */
@Mapper
@CacheNamespace(implementation = CacheHelper.class, eviction = CacheHelper.class)
public interface RoleMapper extends BaseMapper<Role> {

    @ResultMap("BaseResultMap")
    @Select("""
        SELECT o.*
        FROM t_role AS o 
        LEFT JOIN t_emp_role AS o1 ON o1.role_id = o.id
        WHERE o1.emp_id = ${empId}
    """)
    List<Role> findByEmpId(@Param("empId") Long empId);

}
